package com.example.tests;

import static org.junit.Assert.assertTrue;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

@Test
public class Firefox_test {

  private StringBuffer verificationErrors = new StringBuffer();
  WebDriver driver = new FirefoxDriver();
 // WebDriverUtils util = new WebDriverUtils(driver);
  
  public void Firefox_test() throws Exception {
	  
    driver.get("http://www.google.com");
    driver.get("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/");
    driver.findElement(By.id("Email")).clear();
    driver.findElement(By.id("Email")).sendKeys("vitaliiTest12@gmail.com");
    driver.findElement(By.id("Passwd")).clear();
    driver.findElement(By.id("Passwd")).sendKeys("F6v32R3v");
    driver.findElement(By.id("signIn")).click();
    Thread.sleep(5000);
    driver.findElement(By.id("gbqfq")).clear();
    driver.findElement(By.id("gbqfq")).sendKeys("hello user!");
    driver.findElement(By.id("gbqfb")).click();
    Thread.sleep(5000);
  //  util.TakeScreenShot("Test1");
    
    try {
        assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*css=td\\.TC[\\s\\S]*$"));
      } catch (Error e) {
        verificationErrors.append(e.toString());
      }
    driver.findElement(By.id("gbqfq")).click();
    driver.findElement(By.id("gbqfq")).clear();
    driver.findElement(By.id("gbqfq")).sendKeys("hi user!");
    driver.findElement(By.id("gbqfb")).click();
    Thread.sleep(5000);
 //   util.TakeScreenShot("Test");
    try {
        assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*css=td\\.TC[\\s\\S]*$"));
      } catch (Error e) {
        verificationErrors.append(e.toString());
      }
    driver.findElement(By.linkText("vitaliitest12@gmail.com")).click();
    driver.findElement(By.id("gb_71")).click();
    driver.quit();
  }
}
